{template Public:Page:header}

<div class="container">
  <div class="row">
  
	<div class="col-lg-2">
      <div class="row">
        <div class="well">
        <div class="row" style="padding-left:5px;padding-right:5px;">
                <p><a href="/fuwu/publish/index" class="btn btn-darkorange" style="width:100%"><i class="fa fa-pencil"></i>发布服务</a></p>
              
             
              <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>
                                <strong>最新服务</strong>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                    {if $newtask}
                    	{foreach $newtask $task}
                        <tr>
                            <td>
                                <p style="width:160px;height:18px;overflow: hidden;"><a href="/shop/fuwu/{echo $task['id']}" target="_blank"><span class="color_f60">￥{echo $task['money']}</span> {echo $task['subject']}</a></p>
                            </td>
                        </tr>
                        {/foreach}
           			{/if}
                    </tbody>
                </table>
                        
                        
                 <br />
                 <strong>热门服务</strong>
    		
                {if $hottask}
                	{foreach $hottask $task}
                        <div class="task_thumbnail">
                          <a href="/fuwu/{echo $task['id']}" target="_blank"><img alt="{echo $task['subject']}" style="height: 200px; width: 100%; display: block;" src="{if $task['picture']}/{echo $task['picture']}{else}/assets/img/nopicture.png{/if}" data-holder-rendered="true"></a>
                          <div class="caption">
                            <h5><a href="/fuwu/{echo $task['id']}" target="_blank"><span class="color_f60">￥{echo $task['money']}</span> {echo $task['subject']}</a></h5>
                            <p><a role="button" class="btn btn-default" href="/fuwu/{echo $task['id']}">查看</a> <a role="button" class="btn btn-primary" href="javascript:void(0);" onclick="Employ({echo $task['uid']},{echo $task['id']});">购买</a></p>
                          </div>
                        </div>
                    {/foreach}   
               {/if}

      	</div>        
                                
        </div>
      </div>
    </div>
    
    <div class="col-lg-10 well-col-pl-30">
      <div class="row">
       <div class="well">
        
        {if $categoryarr}
        <h5>
        	{foreach $categoryarr $category}
       			 <a href="/fuwu/map/index/{echo $category['route']}" class="btn btn-default">{echo $category['name']}</a>
            {/foreach}
         </h5>
        <br />
        {/if}
        
        
        {if C('otoo_open')==1}
        	{if $categorycityarr}
            <h5>
            城市地区：
        	 <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'city',0)}" class="label btn-primary">{if !empty($city['name'])}{echo $city['name']}{/if}</a> &nbsp; 
                {foreach $categorycityarr $category}
                      <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'city',$category['catid'])}"{if $_GET['city']==$category['catid']} class="label btn-primary"{/if}>{echo $category['name']}</a> &nbsp; 
                {/foreach}
             </h5>
            <br />
        	{/if}
        {/if}
        
        <h5>出售情况：
        <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'buy',0)}"{if !$_GET['buy']} class="label btn-primary"{/if}>全部</a> &nbsp; 
        <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'buy',1)}"{if $_GET['buy']==1} class="label btn-primary"{/if}>已出售</a> &nbsp; 
        <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'buy',2)}"{if $_GET['buy']==2} class="label btn-primary"{/if}>未出售</a> &nbsp; 
        </h5>
         <br />
        <h5>发布时间：
        <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'time',0)}"{if !$_GET['time']} class="label btn-primary"{/if}>全部</a> &nbsp; 
        <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'time',1)}"{if $_GET['time']==1} class="label btn-primary"{/if}>今日</a> &nbsp; 
        <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'time',2)}"{if $_GET['time']==2} class="label btn-primary"{/if}>昨日</a> &nbsp; 
        <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'time',3)}"{if $_GET['time']==3} class="label btn-primary"{/if}>近三天</a> &nbsp; 
        <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'time',4)}"{if $_GET['time']==4} class="label btn-primary"{/if}>近一周</a> &nbsp; 
        <a href="/fuwu/map/index{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'time',5)}"{if $_GET['time']==5} class="label btn-primary"{/if}>近一个月</a> &nbsp; 
        </h5>
        <br />
        <ul class="nav nav-tabs nav_task tabs-flat">
        	{if C('otoo_open')==1}
             <li>
                <a href="/fuwu" style="padding-left:30px;padding-right:30px;">
                    <strong>服务商</strong>
                </a>
            </li>
            <li class="active">
                <a href="/fuwu/map/index" class="btn-primary" style="padding-left:30px;padding-right:30px;">
                    <strong>附近服务</strong>
                </a>
            </li>
            {else}
            <li>
                <a href="/task" style="padding-left:30px;padding-right:30px;">
                    <strong>任务</strong>
                </a>
            </li>
            <li>
                <a href="/rencai" style="padding-left:30px;padding-right:30px;">
                    <strong>服务商</strong>
                </a>
            </li>
            <li class="active">
                <a href="/fuwu" class="btn-primary" style="padding-left:30px;padding-right:30px;">
                    <strong>服务</strong>
                </a>
            </li>
            {/if}
        </ul>
        <div class="btn-primary nav_task_line"></div>
        
      	  <table class="table table-hover">
            <thead>
                <tr>
                    <th colspan="4">
                    <div class="row">
                    <div class="col-lg-8">
                    <div class="DTTT btn-group">
                    	<a href="/fuwu{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'order',0)}" class="btn btn-default">默认</a>
                        <a href="/fuwu{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'order',1)}" class="btn btn-default">推荐 {if $order==1}<i class="fa fa-long-arrow-up"></i>{else}<i class="fa fa-long-arrow-down"></i>{/if}</a>
                        <a href="/fuwu{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'order',2)}" class="btn btn-default">发布时间 {if $order==2}<i class="fa fa-long-arrow-up"></i>{else}<i class="fa fa-long-arrow-down"></i>{/if}</a>
                        <a href="/fuwu{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'order',3)}" class="btn btn-default">出售数  {if $order==3}<i class="fa fa-long-arrow-up"></i>{else}<i class="fa fa-long-arrow-down"></i>{/if}</a>
                        <a href="/fuwu{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'order',4)}" class="btn btn-default">金额  {if $order==4}<i class="fa fa-long-arrow-up"></i>{else}<i class="fa fa-long-arrow-down"></i>{/if}</a> 
                        {if !C('otoo_open')}
                        <div class="btn-group">
                            <a href="javascript:void(0);" class="btn btn-default" id="CategoryNanme">{if $cityname}{echo $cityname}{else}所在地{/if}</a>
                            <a href="javascript:void(0);" data-toggle="dropdown" class="btn btn-default  dropdown-toggle"><i class="fa fa-angle-down"></i></a>
                            <ul class="dropdown-menu city_list" id="City" style="z-index:1001"></ul>
                 		 </div>
                         {/if}
                    </div>   
                    </div> 

                    <div class="col-lg-4">
                   <div class="form-group">
                        <span class="input-icon">
                            <input type="text" class="form-control input-sm" id="TaskSearch" value="{if $search}{echo $search}{/if}">
                            <i class="glyphicon glyphicon-search blue"></i>
                        </span>
                    </div>
                    </div>
                    </div>
                    </th>
                </tr>
            </thead>
        </table>

        <div class="row" style="padding-top:20px;">
        <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak={echo C('baidu_ip_accesskey')}"></script>
      	<div id="Map" style="height:800px;width:100%;"></div>
        </div>
   		
        </div>

    	{if $page}
         <div class="dataTables_paginate paging_bootstrap text-right"><ul class="pagination">{echo $page}</ul></div>
         {/if}
        </div>
    </div>
  </div>
</div>
</div>

<script type="text/javascript">
function showDataJSON(){

	var data_info = [
		{if $list}
            {foreach $list $key=>$value}
				{if $value['longitude'] && $value['latitude']}
					[{echo $value['longitude']},{echo $value['latitude']},'<p><span class="color_f60">￥{echo $value['money']}</span> <a href="/shop/fuwu/{echo $value['id']}" target="_blank">{echo $value['subject']}</a> 出售：{echo $value['sell_number']}</p><p><span class="text-muted">{echo $value['description']}</span></p>',' <a href="/shop/{echo $value['uid']}" target="_blank">{echo str_replace("'",'"',GetAvatarSimple($value['uid'],48,'img-rounded'))} {echo $value['username']} </a>'],
				{/if}
			{/foreach}
 		{/if}
	];
	
	
	 for(var i=0;i<data_info.length;i++){
		var marker = new BMap.Marker(new BMap.Point(data_info[i][0],data_info[i][1]));  // 创建标注
		var content = data_info[i][2];
		var username = data_info[i][3];
		map.addOverlay(marker);               
		addClickHandler(content,username,marker);
	}
	function addClickHandler(content,username,marker){
		marker.addEventListener("click",function(e){
			openInfo(content,username,e)
		});
	}
	function openInfo(content,username,e){
		var p = e.target;
		var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
		var infoWindow = new BMap.InfoWindow(content,{
				width : 300,     // 信息窗口宽度
				height: 120,     // 信息窗口高度
				title : username , // 信息窗口标题
				enableMessage:true//设置允许信息窗发送短息
			   });   
		map.openInfoWindow(infoWindow,point); 
	}
}
$(function(){
	map = new BMap.Map("Map");
	map.centerAndZoom(new BMap.Point({echo session("PointX")},{echo session("PointY")}), 15);
	
	//map.addEventListener("onmouseup",function(e){
		//alert(e.point.lng);
		//alert(e.point.lat);
	//});	
	
	showDataJSON();	
								
});
</script>

{if !C('otoo_open')}
<script type="text/javascript">
$(function(){	
	SetFormCity(AURL+"/js/foxphp_json_city.js",'#City','SelectCityID');
	
	$('#TaskSearch').keydown(function(e){
		if(e.keyCode==13){
			var url="/fuwu{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'search','')}";
		    window.location.href=url+'/'+$(this).val();
		}
	}); 
});


function SelectCityID(id,name){
	var url="/fuwu{if $route}{echo '/'.$route}{/if}{echo $model->SelectMakeUrl($model->selectfuwukey,'city','')}";
	window.location.href=url.replace('/c/','/c'+id+'/');
}
</script>
{/if}

{template Shop:Fuwu:employ}

{template Public:Page:footer}